package shop

import (
	"context"
	"fast-boot/app/api/admin/internal/svc"
	"fast-boot/app/api/admin/internal/types"
	"fast-boot/app/model"

	"github.com/zeromicro/go-zero/core/logx"
)

type BrandGetLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

// 获取Brand
func NewBrandGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *BrandGetLogic {
	return &BrandGetLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *BrandGetLogic) BrandGet(req *types.BrandGetReq) (resp *types.PmsBrand, err error) {

	if err = l.svcCtx.GormClient.GormDb.Model(model.PmsBrandModel{}).First(resp, req.Id).Error; err != nil {
		return nil, err
	}

	return resp, nil
}
